# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.WorkloadManager.V1.Model.Execution do
  @moduledoc """
  Message describing Execution object

  ## Attributes

  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. [Output only] End time stamp
  *   `evaluationId` (*type:* `String.t`, *default:* `nil`) - Output only. [Output only] Evaluation ID
  *   `externalDataSources` (*type:* `list(GoogleApi.WorkloadManager.V1.Model.ExternalDataSources.t)`, *default:* `nil`) - Optional. External data sources
  *   `inventoryTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. [Output only] Inventory time stamp
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels as key value pairs
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of execution resource. The format is projects/{project}/locations/{location}/evaluations/{evaluation}/executions/{execution}
  *   `notices` (*type:* `list(GoogleApi.WorkloadManager.V1.Model.Notice.t)`, *default:* `nil`) - Output only. Additional information generated by the execution
  *   `resultSummary` (*type:* `GoogleApi.WorkloadManager.V1.Model.Summary.t`, *default:* `nil`) - Output only. [Output only] Result summary for the execution
  *   `ruleResults` (*type:* `list(GoogleApi.WorkloadManager.V1.Model.RuleExecutionResult.t)`, *default:* `nil`) - Output only. execution result summary per rule
  *   `runType` (*type:* `String.t`, *default:* `nil`) - type represent whether the execution executed directly by user or scheduled according evaluation.schedule field.
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. [Output only] Start time stamp
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. [Output only] State
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :endTime => DateTime.t() | nil,
          :evaluationId => String.t() | nil,
          :externalDataSources =>
            list(GoogleApi.WorkloadManager.V1.Model.ExternalDataSources.t()) | nil,
          :inventoryTime => DateTime.t() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :notices => list(GoogleApi.WorkloadManager.V1.Model.Notice.t()) | nil,
          :resultSummary => GoogleApi.WorkloadManager.V1.Model.Summary.t() | nil,
          :ruleResults => list(GoogleApi.WorkloadManager.V1.Model.RuleExecutionResult.t()) | nil,
          :runType => String.t() | nil,
          :startTime => DateTime.t() | nil,
          :state => String.t() | nil
        }

  field(:endTime, as: DateTime)
  field(:evaluationId)

  field(:externalDataSources,
    as: GoogleApi.WorkloadManager.V1.Model.ExternalDataSources,
    type: :list
  )

  field(:inventoryTime, as: DateTime)
  field(:labels, type: :map)
  field(:name)
  field(:notices, as: GoogleApi.WorkloadManager.V1.Model.Notice, type: :list)
  field(:resultSummary, as: GoogleApi.WorkloadManager.V1.Model.Summary)
  field(:ruleResults, as: GoogleApi.WorkloadManager.V1.Model.RuleExecutionResult, type: :list)
  field(:runType)
  field(:startTime, as: DateTime)
  field(:state)
end

defimpl Poison.Decoder, for: GoogleApi.WorkloadManager.V1.Model.Execution do
  def decode(value, options) do
    GoogleApi.WorkloadManager.V1.Model.Execution.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.WorkloadManager.V1.Model.Execution do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
